﻿CREATE PROCEDURE [dbo].[ew_sp_install_post]
    @uid_easyweb_id UNIQUEIDENTIFIER, 
    @vc_name        VARCHAR(512), 
    @vc_version     VARCHAR(1024), 
    @dt_datetime    DATETIME,
    @nvc_user       NVARCHAR(1024)
AS
    IF NOT EXISTS (SELECT 1 FROM ew_tbl_easyweb WHERE ew_uid_easyweb_id = @uid_easyweb_id)
    BEGIN
        INSERT ew_tbl_easyweb (
            ew_uid_easyweb_id, 
            ew_vc_name, 
            ew_vc_version, 
            ew_dt_created, 
            ew_nvc_created_by, 
            ew_dt_modified, 
            ew_nvc_modified_by)
        VALUES (
            @uid_easyweb_id, 
            @vc_name, 
            @vc_version, 
            @dt_datetime, 
            @nvc_user, 
            @dt_datetime, 
            @nvc_user)
    END
    ELSE
    BEGIN
        UPDATE ew_tbl_easyweb SET
            ew_vc_name          = @vc_name,
            ew_vc_version       = @vc_version,
            ew_dt_modified      = @dt_datetime,
            ew_nvc_modified_by  = @nvc_user
        WHERE ew_uid_easyweb_id = @uid_easyweb_id
    END
RETURN 0
